package com.xiaoma.web;

import com.xiaoma.domain.Login;
import com.xiaoma.observer.SendChannels;
import com.xiaoma.valid.ValidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @description  
 * @author wangtianxiang
 * @date: 2021/11/18 16:39
 */
@RequestMapping(value = "/test")
@RestController
public class TestController {

    @Autowired
    private SendChannels channels;

    @RequestMapping(value = "test")
    public String test(Login login){
        if(!ValidUtil.valid(login).isEmpty()){
           return ValidUtil.valid(login).get(0);
        }
        channels.send(login.getUserName());
        return "成功";
    }




}
